#[allow(unused)]
fn part1() {
    let input = include_str!("../input.txt");

    let res = input
        .split("\r\n\r\n")
        .map(|one_elf_lines| -> i32 {
            one_elf_lines.lines().map(|line| line.parse::<i32>().unwrap()).sum()
        })
        .max().unwrap();

    println!("Part 1: {res}");
}

#[allow(unused)]
fn part2() {
    let input = include_str!("../input.txt");

    let mut elfs_food = input
        .split("\r\n\r\n")
        .map(|one_elf_lines| -> i32 {
            one_elf_lines
                .lines()
                .map(|line| line.parse::<i32>().unwrap())
                .sum()
        }).collect::<Vec<i32>>();

    elfs_food.sort_by(|a, b| b.cmp(a));

    println!("Part 2: {}", elfs_food[0] + elfs_food[1] + elfs_food[2]);
}

fn main() {
    part1();   
    part2();
}
